<% provide :pre_title, t("console-nav.user") + ' | ' + t("console") %>
<% provide :bodyclass, "admin" %>
<% provide :index, '1' %>

<div id="users">
  <div class="boxed-group">
    <%= content_tag :h3, t("console-nav.user") %>
    <div class="boxed-group-inner">

      <ul class="nav nav-tabs">
        <%= content_tag :li, link_to(t("c-summary.total"), admin_users_path), class: "#{'active' if @value == 1 }" %>

        <%= content_tag :li, link_to(t("c-summary.user.normal"), admin_users_path(by: 'normal')), class: "#{'active' if @value == 2 }" %>

        <%= content_tag :li, link_to(t("c-summary.user.admin"), admin_users_path(by: 'admin')), class: "#{'active' if @value == 3 }" %>

        <%= content_tag :li, link_to(t("c-summary.user.disabled"), admin_users_path(by: 'disabled')), class: "#{'active' if @value == 4 }" %>

        <%= content_tag :a, href: new_admin_user_path, class: 'pull-right', title: t('c-summary.user.new') do -%>
          <%= content_tag :span, '', class: 'glyphicon glyphicon-plus' %>
        <% end -%>
      </ul>

      <div id="body-content">
        <%= render 'users_table', users: @users %>
        <%= will_paginate @users, renderer: WillPaginate::ActionView::BlogLinkRenderer %>
      </div>

    </div>
  </div>
</div>
<%= render 'admin/features/confirm_delete_dialog' %>

<script>
  $("#body-content").on("click", "#to-delete", function(){
      text = $(this).attr("value");
      text = "<%= j t('ask.user_delete.pre') %>" + text + "<%= j t('ask.user_delete.suf') %>";
      $("#confirm-delete .modal-body").html(text);
      $("#confirm-delete #confirm").attr('href', $(this).attr('href'));
      $("#confirm-delete").modal();
      return false;
  });
</script>